<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$info=pdo_get('zh_gjhdbm_type',array('id'=>$_GPC['id']));

if(checksubmit('submit')){
        $data['type_name']=$_GPC['type_name'];
        $data['img']=$_GPC['img'];
        $data['num']=$_GPC['num'];
        $data['num']=$_GPC['num'];
        $data['state']=$_GPC['state'];
        $data['time']=time();
        $data['uniacid']=$_W['uniacid'];   
     if($_GPC['id']==''){  
        $rst=pdo_insert('zh_gjhdbm_type',$data);      
        if($rst){
             message('添加成功！', $this->createWebUrl('type'), 'success');
        }else{
             message('添加失败！','','error');
        }
    }else{
         $rst=pdo_update('zh_gjhdbm_type',$data,array('id'=>$_GPC['id']));
        if($rst){
             message('编辑成功！', $this->createWebUrl('type'), 'success');
        }else{
             message('编辑失败！','','error');
        }
    }
}
include $this->template('web/addtype');